package com.xu.cloud.common.sequence.wrapper;

import com.xu.cloud.common.sequence.ISequence;

/**
 * 带前缀的序列生成器
 *
 * @author xuguan
 * @since 2025/2/12
 */
public class PrefixSequenceWrapper implements ISequence {
    private final ISequence sequence;
    private String prefix = "";

    public PrefixSequenceWrapper(ISequence sequence) {
        this.sequence = sequence;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    @Override
    public String nextId() {
        return prefix + sequence.nextId();
    }
}
